package net.hn.hnms.biz.performance.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.hn.hnms.biz.performance.request.PerformanceScoringDetailsReq;
import net.hn.hnms.biz.performance.service.PerformanceScoringDetailsService;
import net.hn.hnms.biz.performance.vo.PerformanceScoringDetailsVo;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.mybatis.core.page.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "绩效打分明细项", tags = {"绩效指标"})
@RestController
@RequestMapping("/performanceScoringDetails/management")
public class PerformanceScoringDetailsController {


    @Autowired
    private PerformanceScoringDetailsService performanceScoringDetailsService;


    @GetMapping("/page")
    @ApiOperation("绩效打分查看详情")
    public R<Page<PerformanceScoringDetailsVo>> page(PageQuery pageQuery, PerformanceScoringDetailsReq req) {
        Page<PerformanceScoringDetailsVo> page = performanceScoringDetailsService.getPerformanceScoringDetails(pageQuery, req);
        System.out.println(page.getRecords());

        return R.ok(page);
    }

    @DeleteMapping("/delete")
    @ApiOperation("绩效打分详情删除")
    public R delete(@RequestParam("ids") List<String> ids) {
        return R.ok(performanceScoringDetailsService.delete(ids));
    }


    @PostMapping("/update")
    @ApiOperation("绩效打分详情修改")
    public R update(@RequestBody PerformanceScoringDetailsReq req) {
        return R.ok(performanceScoringDetailsService.update(req));
    }


}
